package com.zbl.parser;

import com.xuxueli.crawler.parser.strategy.NonPageParser;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

/**
 * @Author: zhangjun
 * @Date: 2020/7/31 13:42
 * @Description:
 */
public class CourseJsoupParse extends NonPageParser {

    @Override
    public void parse(String url, String pageSource) {
        Document document = Jsoup.parse(pageSource);
        Elements divs = document.select(".all-course-main .js-course-list .courseitem");
        for (Element div : divs) {
            Element item = div.select(".course-list .title a").first();
            Element item2 = div.select(".course-list .study-info span:eq(1)").first();
            System.out.println("课程名称：" + item.text() + ",\t" + item2.text());
        }
    }
}
